package com.aaa.ssm.controller;

import com.aaa.ssm.entity.TAbout;
import com.aaa.ssm.service.TAboutService;
import com.aaa.ssm.util.Page;
import com.aaa.ssm.util.Result;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;


@RestController
@RequestMapping("tAbout")
public class TAboutController extends BaseController {
    /**
     * 服务对象
     */
    @Resource
    private TAboutService tAboutService;

   @PostMapping("queryById")
    public Result queryById(@RequestBody Page<TAbout> page) {
        return success(tAboutService.queryById(page));
    }

    /**
     * 新增数据
     *
     * @param tAbout 实体
     * @return 新增结果
     */
    @PostMapping("add")
    public Result add(@RequestBody TAbout tAbout) {
        return success(tAboutService.insert(tAbout));
    }

    /**
     * 编辑数据
     *
     * @param tAbout 实体
     * @return 编辑结果
     */
   @PostMapping("update")
    public Result edit(@RequestBody TAbout tAbout) {
        return success(tAboutService.update(tAbout));
    }

    /**
     * 删除数据
     *
     * @param id 主键
     * @return 删除是否成功
     */
    @DeleteMapping("deleteById/{id}")
    public Result deleteById(@PathVariable("id") String id) {
        return success(tAboutService.deleteById(id));
    }

}

